<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <base href="<%=basePath%>">

        <title>My JSP 'index.jsp' starting page</title>
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    </head>

    <body>
    <CENTER>
        <h3>学生信息表</h3>
        <table border="2">
            <tr>
                <td>
                    序号
                </td>
                <td>
                    姓名
                </td>
                <td>
                    性别
                </td>
                <td align="center">
                    操作
                </td>
            </tr>
            
            <c:forEach var="i" items="${list}"  varStatus="f">
                <tr <c:if test="${f.index%2==0}">style="background-color:orange;"</c:if>>
                    <td>
                        ${i.sid }
                    </td>
                    <td>
                        ${i.sname }
                    </td>
                    <td>
                        ${i.sex }
                    </td>
                    <td>
                        <a href="register.jsp">添加</a>
                        &nbsp;&nbsp;
                        <a href="FindByIdSerlvet?sid=${i.sid}">修改</a>
                        &nbsp;&nbsp;
                        <a href="DeleteSerlvet?sid=${i.sid}">删除</a>
                        
                    </td>
                </tr>
            </c:forEach>
            
        </table>
        <div>
        
        
        第${page.pageno}/${page.totalpage}页 &nbsp;&nbsp;
        <a href="FindAllServlet?pageNo=1">首页</a>
        <c:choose>
          <c:when test="${page.pageno gt 1}">
            <a href="FindAllServlet?pageNo=${page.pageno-1 }">上一页</a>
          </c:when>
          <c:otherwise>
            <a href="javascript:alert('已经是第一页了,没有上一页!');">上一页</a>
          </c:otherwise>
        </c:choose>
        <c:choose>
          <c:when test="${page.pageno lt page.totalpage}">
            <a href="FindAllServlet?pageNo=${page.pageno+1 }">下一页</a>
          </c:when>
          <c:otherwise>
            <a href="javascript:alert('已经是最有一页了,没有下一页!');">下一页</a>
          </c:otherwise>
        </c:choose>
        
        <a href="FindAllServlet?pageNo=${page.totalpage}">末页</a>
        &nbsp;&nbsp;
        共${page.totalcount}条
        
        </div>
        
    </CENTER>
        
    </body>
</html>